package com.yonyou.pmclouds.constructiondiary.process;

import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.constructiondiary.entity.ConstructionDiaryVO;
import org.apache.commons.lang3.StringUtils;

public class ConstructionDiaryInsertCheckProcessor implements SingleProcessor<ConstructionDiaryVO> {
    @Override
    public void process(ConstructionDiaryVO vo, ConstructionDiaryVO orig) throws BusinessException {
        if(vo == null){
            throw new BusinessException("新增施工日志为空");
        }else{
            if(StringUtils.isEmpty(vo.getDiaryContent()) && (vo.getPictures() == null || vo.getPictures().length == 0)){
                throw new BusinessException("日志内容和图片同时为空");
            }
        }
    }
}
